/*
 * @Descripttion: 
 * @version: 
 * @Author: ada.wu
 * @Date: 2023-11-20 23:40:19
 * @LastEditors: ada.wu
 * @LastEditTime: 2023-11-21 23:49:03
 */

import { ref } from 'vue';
import { defineStore } from 'pinia';
import EsAjax from '@/utils/EsAjax';
import ApiUrls from '@/apis/index';

/**
 * 
 */
export default defineStore('floor', () => {
  // 权限代码数据
  const floorList = ref([]);
  function getFloorList(id) {
    console.log(id)
    floorList.value = []
    EsAjax.post(ApiUrls.floorBuildingfloor, { id:id }).then(res => {
      if (res.data.data && res.data.data.length) {
        res.data.data.forEach(element => {
          element.name = element.floor
        });
        floorList.value = res.data.data || [];
      }
    }).catch(err => {
      ElMessage.error(err.message);
    })
  }

  return {
    floorList,
    getFloorList
  }
}) 